<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>fullscreen.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_dom_fullscreen.js.html">fullscreen.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2012 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Functions for managing full screen status of the DOM.
<a name="line17"></a> *
<a name="line18"></a> */
<a name="line19"></a>
<a name="line20"></a>goog.provide(&#39;goog.dom.fullscreen&#39;);
<a name="line21"></a>goog.provide(&#39;goog.dom.fullscreen.EventType&#39;);
<a name="line22"></a>
<a name="line23"></a>goog.require(&#39;goog.dom&#39;);
<a name="line24"></a>goog.require(&#39;goog.userAgent&#39;);
<a name="line25"></a>goog.require(&#39;goog.userAgent.product&#39;);
<a name="line26"></a>
<a name="line27"></a>
<a name="line28"></a>/**
<a name="line29"></a> * Event types for full screen.
<a name="line30"></a> * @enum {string}
<a name="line31"></a> */
<a name="line32"></a>goog.dom.fullscreen.EventType = {
<a name="line33"></a>  /** Dispatched by the Document when the fullscreen status changes. */
<a name="line34"></a>  CHANGE: goog.userAgent.WEBKIT ?
<a name="line35"></a>      &#39;webkitfullscreenchange&#39; :
<a name="line36"></a>      &#39;mozfullscreenchange&#39;
<a name="line37"></a>};
<a name="line38"></a>
<a name="line39"></a>
<a name="line40"></a>/**
<a name="line41"></a> * Determines if full screen is supported.
<a name="line42"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line43"></a> *     queried. If not provided, use the current DOM.
<a name="line44"></a> * @return {boolean} True iff full screen is supported.
<a name="line45"></a> */
<a name="line46"></a>goog.dom.fullscreen.isSupported = function(opt_domHelper) {
<a name="line47"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line48"></a>  var body = doc.body;
<a name="line49"></a>  return !!body.webkitRequestFullScreen ||
<a name="line50"></a>      (!!body.mozRequestFullScreen &amp;&amp; doc.mozFullScreenEnabled);
<a name="line51"></a>};
<a name="line52"></a>
<a name="line53"></a>
<a name="line54"></a>/**
<a name="line55"></a> * Requests putting the element in full screen.
<a name="line56"></a> * @param {!Element} element The element to put full screen.
<a name="line57"></a> */
<a name="line58"></a>goog.dom.fullscreen.requestFullScreen = function(element) {
<a name="line59"></a>  if (element.webkitRequestFullScreen) {
<a name="line60"></a>    element.webkitRequestFullScreen();
<a name="line61"></a>  } else if (element.mozRequestFullScreen) {
<a name="line62"></a>    element.mozRequestFullScreen();
<a name="line63"></a>  }
<a name="line64"></a>};
<a name="line65"></a>
<a name="line66"></a>
<a name="line67"></a>/**
<a name="line68"></a> * Requests putting the element in full screen with full keyboard access.
<a name="line69"></a> * @param {!Element} element The element to put full screen.
<a name="line70"></a> */
<a name="line71"></a>goog.dom.fullscreen.requestFullScreenWithKeys = function(
<a name="line72"></a>    element) {
<a name="line73"></a>  if (element.mozRequestFullScreenWithKeys) {
<a name="line74"></a>    element.mozRequestFullScreenWithKeys();
<a name="line75"></a>  } else if (element.webkitRequestFullScreen &amp;&amp;
<a name="line76"></a>      element.ALLOW_KEYBOARD_INPUT &amp;&amp;
<a name="line77"></a>      goog.userAgent.product.CHROME) {
<a name="line78"></a>    // Safari has the ALLOW_KEYBOARD_INPUT property but using it gives an error.
<a name="line79"></a>    element.webkitRequestFullScreen(element.ALLOW_KEYBOARD_INPUT);
<a name="line80"></a>  } else {
<a name="line81"></a>    goog.dom.fullscreen.requestFullScreen(element);
<a name="line82"></a>  }
<a name="line83"></a>};
<a name="line84"></a>
<a name="line85"></a>
<a name="line86"></a>/**
<a name="line87"></a> * Exits full screen.
<a name="line88"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line89"></a> *     queried. If not provided, use the current DOM.
<a name="line90"></a> */
<a name="line91"></a>goog.dom.fullscreen.exitFullScreen = function(opt_domHelper) {
<a name="line92"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line93"></a>  if (doc.webkitCancelFullScreen) {
<a name="line94"></a>    doc.webkitCancelFullScreen();
<a name="line95"></a>  } else if (doc.mozCancelFullScreen) {
<a name="line96"></a>    doc.mozCancelFullScreen();
<a name="line97"></a>  }
<a name="line98"></a>};
<a name="line99"></a>
<a name="line100"></a>
<a name="line101"></a>/**
<a name="line102"></a> * Determines if the document is full screen.
<a name="line103"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line104"></a> *     queried. If not provided, use the current DOM.
<a name="line105"></a> * @return {boolean} Whether the document is full screen.
<a name="line106"></a> */
<a name="line107"></a>goog.dom.fullscreen.isFullScreen = function(opt_domHelper) {
<a name="line108"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line109"></a>  return !!doc.webkitIsFullScreen || !!doc.mozFullScreen;
<a name="line110"></a>};
<a name="line111"></a>
<a name="line112"></a>
<a name="line113"></a>/**
<a name="line114"></a> * Gets the document object of the dom.
<a name="line115"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line116"></a> *     queried. If not provided, use the current DOM.
<a name="line117"></a> * @return {!Document} The dom document.
<a name="line118"></a> * @private
<a name="line119"></a> */
<a name="line120"></a>goog.dom.fullscreen.getDocument_ = function(opt_domHelper) {
<a name="line121"></a>  return opt_domHelper ?
<a name="line122"></a>      opt_domHelper.getDocument() :
<a name="line123"></a>      goog.dom.getDomHelper().getDocument();
<a name="line124"></a>};
</pre>


</body>
</html>
